package com.baida.retail.tasksystem.event.listener;

import com.baida.retail.tasksystem.event.event.BlackListEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 事件监听处理器--关键点要继承ApplicationListener
 */
@Component
@Slf4j
public class BlackListListener  implements ApplicationListener<BlackListEvent> {
    /**
     * Handle an application event.
     *
     * @param event the event to respond to
     */
    @Override
    @Async //事件进行异步执行
    public void onApplicationEvent(BlackListEvent event) {
        log.info("onApplicationEvent event={}", event);
    }
}
